#include "C_CamDet.h"
#include <stdio.h>

CamPos camPos;
CP_MUTEXLOCK mlock;

void updatePosition(CamPos * camPos, CP_MUTEXLOCK * mlock);
void __stdcall *threadFunc(void *arg)
{
	updatePosition(&camPos, &mlock);
	return 0;
}


#ifndef TEST
int main()
{
	// CreateMutex();

	mlock = CreatMutexCP();

	camPos.err_no = 0;
#ifdef WIN32
	CreatThreadCP(threadFunc);
#else
	pthread_t pt;
	pthread_create(&pt, NULL, threadFunc, NULL);
#endif
	while (true)
	{
		
		WaitMutexCP(mlock);
		//printf("ready come in thread...\n");
		if(camPos.isDetected)
			printf("quantity: %d , id: %d\n", camPos.quantity, camPos.markInfo[0].id);
		else
			printf("can't find any mark\n");
		ExitMutexCP(mlock);
		DelayCP(500);
	}

	return 0;
}
#endif // !TEST

